package com.pubg.information.mapper;

import com.pubg.information.bean.Rotation;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RotationMapper {

    @Select("select * from rotation where `lock` = '1' and type = #{type}")
    public List<Rotation> getRotation(String type);

    //根据ID查询
    @Select("select type from rotation where id = #{id}")
    public String getRotationById(String id);

    //根据Id查询信息
    @Select("select * from rotation where id = #{id}")
    public Rotation selRotationById(String id);

    //根据ID删除（将lock变更为2）
    @Update("update rotation set `lock` = '2' where id = #{id}")
    public void updLock(String id);

    //insert
    @Insert("insert into rotation (title,subtitle,type,content,`lock`,img,video) values (#{title},#{subtitle},#{type},#{content},#{lock},#{img},#{video})")
    @Options(useGeneratedKeys=true,keyProperty="id")
    public int  insRoation(Rotation roation);
}
